<template>
  <div class="pre-file">
    <a class="light" target="_blank" :href="uploadValue.url">{{ contractName || uploadValue.name }}</a>
  </div>
</template>

<script setup>
  import { onMounted, ref } from 'vue'
  import { getFileInfo } from '@/api/common/index.js'
  const props = defineProps({
    id: [String, Number],
    contractName: String,
  })

  const uploadValue = ref({})
  onMounted(() => {
    const id = props.id
    getFileInfo({ id: id }).then((res) => {
      const result = res.result
      console.log(result, 'result')
      uploadValue.value = {
        uid: result.fileIdStr,
        name: result.originalFileName,
        url: `${import.meta.env.VITE_BASE_PATH}/uploadFile/image/${result.fileIdStr}`,
      }
    })
  })
</script>

<style lang="less" scoped>
  .pre-file {
    font-size: 15px;
    font-weight: 400;
    color: #9ea5bb;
    line-height: 22px;
    & .light {
      color: #1890ff;
      border-bottom: 1px solid;
    }
  }
</style>
